//-------------------------------------------------------------------
//	Copyright (c) 2012-2014 Zhirnov Andrey
//	This file is part of the "UXGEN-ES" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#pragma once

#include "Scene2D/Objects/SceneObject.h"

namespace Engine
{
namespace Scene2D
{


	//
	// Scene Camera
	//

	class SceneCamera : public SceneObject
	{
	// types
	public:
		struct ECamera
		{
			enum type
			{
				UNKNOWN = 0,
				SIDE,
				UP,
			};
		};


	// variables
	protected:
		ECamera::type	_camType;
		bool			_active;


	// methods
	public:
		SceneCamera ();
		~SceneCamera ()	{}


		void SetCameraType (ECamera::type type);

		void Active (bool active)		{ _active = active; }
		bool IsActive () const			{ return _active; }


		// SceneObject //
		bool ProcessMessage (const SceneObjMsg &msg) override;


	private:
		bool _Update (const SceneObjMsg &msg);
	};


	
/*
=================================================
	constructor
=================================================
*/
	inline SceneCamera::SceneCamera () :
		SceneObject( ESceneObj::CAMERA ), _camType(ECamera::UNKNOWN), _active(false)
	{}

/*
=================================================
	SetCameraType
=================================================
*/
	inline void SceneCamera::SetCameraType (ECamera::type type)
	{
		// TODO
		_camType = type;
	}
	
/*
=================================================
	ProcessMessage
=================================================
*/
	inline bool SceneCamera::ProcessMessage (const SceneObjMsg &msg)
	{
		typedef SceneObjMsg		SO;

		switch ( msg.GetType() )
		{
			case SO::UPDATE :		return _Update( msg );
		}
		return SceneObject::ProcessMessage( msg );
	}
	
/*
=================================================
	_Update
=================================================
*/
	inline bool SceneCamera::_Update (const SceneObjMsg &msg)
	{
		if ( IsActive() )
		{
			GetSceneManager()->SetCamera( this );
		}
		return true;
	}

	
}	// Scene2D
}	// Engine